
#ifndef PLANENTRY_H_
#define PLANENTRY_H_

#include <utility>
#include <vector>
#include <boost/utility.hpp>
#include <boost/foreach.hpp>

#include "Substitution.hpp"

namespace fixstoker {

class PlanEntry: private boost::noncopyable {
public:

	PlanEntry(const int msgTemplateIndex, const std::vector<const Substitution*>& substitutions) :
		msgTemplateIndex_(msgTemplateIndex), substitutions_(substitutions) {
	}

	PlanEntry(const int index, const Substitution* substitution) :
		msgTemplateIndex_(index), substitutions_(1) {
		substitutions_.push_back(substitution);
	}

	virtual ~PlanEntry() {
		for (std::vector<const Substitution*>::iterator it =
				substitutions_.begin(); it != substitutions_.end(); it++) {
			const Substitution* entry = *it;
			delete entry;
		}
		substitutions_.clear();
	}

	unsigned int msgTemplateIndex() const {
		return msgTemplateIndex_;
	}

	const std::vector<const Substitution*>& substitutions() const {
		return substitutions_;
	}

private:
	unsigned int msgTemplateIndex_;
	std::vector<const Substitution*> substitutions_;

};

}

#endif /* PLANENTRY_H_ */
